package com.dyh.quickdemo.demos.MapObj;

import com.dyh.quickdemo.bizDemo.PlatformSplit.M;

import java.util.HashMap;
import java.util.Map;
import java.util.function.*;

/*
@Author=Joey Wheeler
@Date=2021/1/8 15:26
*/
public class Student {

    protected Map<String,Object> medium = new HashMap<>();

    public  enum field{

        name("姓名",
                (stu,data)->stu.medium.put("name",data),
                stu->stu.medium.get("name")
        ),
        ;
        String desc;
        BiConsumer<Student,String> setter;
        Function<Student,?> getter;

        field(String desc, BiConsumer<Student,String> setter,Function<Student,?> getter){
            this.desc =desc;
            this.getter = getter;
            this.setter = setter;
        }

    }
//    public  Supplier<String> getName=()->(String) medium.get("name");
//
//    public Consumer<String> setName=e->medium.put("name",e);

    public static void main(String[] args) {
        Student student = new Student();
        field.name.setter.accept(student,"dawd");
        String name = (String) field.name.getter.apply(student);
        System.out.println();
    }

}
